package com.java.threadsafe.vsafe2;

/* 不使用实例变量，把变量封装到方法内部 */
public class ThreadSafeEntity implements Runnable {

	@Override
	public void run() {
		int num = 1;
		for(int i=0; i<5; i++){
			++num;
			try {
				Thread.sleep(1000);
			} catch (InterruptedException e) {
				e.printStackTrace();
			}
			System.out.println(Thread.currentThread().getName() + " ---- " + num);
		}

	}

}
